import { fetchList } from '@/api/tag'
const classfiy = {
  state: {
    tagList: [],
    tagTotal: 0
  },
  getters: {
    tagList: state => state.tagList,
    tagTotal: state => state.tagTotal
  },
  mutations: {
    SET_TAGLIST: (state, tagList) => {
      state.tagList = tagList
    },
    SET_TAGTOTAL: (state, total) => {
      state.tagTotal = total
    }
  },
  actions: {
    async getTagList ({commit}, listQuery) {
      let res = await fetchList(listQuery)
      let items = res.data.items
      let total = res.data.total
      commit('SET_TAGLIST', items)
      commit('SET_TAGTOTAL', total)
      return items
    }
  }
}
export default classfiy
